#pragma once
#include "GObject.h"
#include "Vector.h"

class MObject:public GObject
{
protected:
	int _objectType;
	float _vx;
	float _vy;
	DWORD _deltaTime;

	float _lastX,_lastY;

	bool _canChangeVelocity;

	bool _isFalling;

	int _status;

	bool _isAnimating;

	bool _recentChangeVel;

	bool _enablePushBackVector;

	int _mainResourceName;

	float _percent;

	float _scored;

public:
	MObject(void);
	MObject(int x, int y, int Width, int Height, float vx, float vy, int deltaTime, LPD3DXSPRITE spriteHandler, LPDIRECT3DTEXTURE9 image);
	MObject(float x, float y, float vx, float vy, int deltaTime,int resourceName,CResourceManager* rm);
	MObject(float x, float y, float vx, float vy, int deltaTime,int resourceName);

	virtual void Move();
	virtual void Render();
	virtual void Animate(){};

	Vector getVelocityVector();
	virtual void setVelocity(Vector v, shared_ptr<MObject> Object);

	void setPushBackVector(const Vector &PVector);

	Vector getPushBackVector();

	int getTranslateDirection(Vector translateVector);

	void setFallingStatus(bool isFalling){_isFalling = isFalling;};

	bool isAnimating(){return _isAnimating;};
	void setAnimating(bool isAnimating) {_isAnimating = isAnimating;};

	~MObject(void);


	void Translate(Vector v,shared_ptr<MObject> object);

	virtual void actAfterCollided(int Direction, shared_ptr<MObject> Object){};

	int getObjectType(){return _objectType;};
	void setObjectType(int objectType){ _objectType = objectType;};

	virtual void setStatus(int Status){ _status = Status;};
	int getStatus(){return _status;};

	virtual void LoadResource(CResourceManager* rm);

	virtual bool getAllowJump(){return true;};
	virtual void setAllowJump(bool allowJump){};
	virtual int getLastDir(){return 0;};
	virtual int getLevel(){return 0;};
	virtual void setLevel(int level, bool flash){};
	virtual void Jump(){};
	virtual void MoveLeft(){};
	virtual void MoveRight(){};

	void setPercent(float percent) {_percent = percent;};

	float getObjectScore(){return _scored;};
};

